package org.spring.activemq.demo;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;

import org.apache.activemq.command.ActiveMQObjectMessage;
import org.springframework.jms.core.JmsTemplate;

public class Consumer implements MessageListener {
	private JmsTemplate jmsTemplate;

	public void onMessage(Message arg0) {

		ActiveMQObjectMessage msg = (ActiveMQObjectMessage) arg0;
		try {
			System.out.print("From -->" + msg.getStringProperty("id"));
			System.out.println("-->" + msg.getStringProperty("hello"));

		} catch (JMSException e) {
			e.printStackTrace();
		}
	}

	public JmsTemplate getJmsTemplate() {
		return jmsTemplate;
	}

	public void setJmsTemplate(JmsTemplate jmsTemplate) {
		this.jmsTemplate = jmsTemplate;
	}

}
